<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin: 0px;
        padding: 0px;
        list-style: none;
    }
    textarea{
        width: 800px;
        margin:10px auto;
        display: block;
        resize: none;
        outline: none;
    }
    button{
        width: 800px;
        margin:10px auto;
        display: block;
        background:#f60;
        border: none;
        cursor: pointer;
        line-height: 40px;
        color:white;
    }
    ul{
        width: 800px;
        margin:10px auto;
        display: block;
    }
    li{
        background:lightgreen;
        padding:10px;
        margin-bottom: 10px;
        position: relative;
    }
    span{
        position: absolute;
        right: -5px;
        top:-5px;
        cursor: pointer;
    }
</style>
</head>
<body>
<textarea name="" id="txt" cols="30" rows="10"></textarea>
<button id="btn">发微博啦看什么看</button>
<ul id="con">
    <li>
        我是傻逼，太他妈棒了，把小鱼的头打烂
        <p>2021-06-08</p>
        <span onclick="del(this)">X</span>
    </li> 
</ul>
<script>
    var con=document.getElementById('con')
    var txt=document.getElementById('txt')
    var btn=document.getElementById('btn')
    btn.onclick=function(){
        
         if(txt.value==''){
            alert('你不够帅发不了微博')
        }else{
            var tag=document.createElement('li');
        tag.innerHTML=`${txt.value}
        <p>2021-06-10</p>
        <span onclick="del(this)">X</span>`;
        con.appendChild(tag)
        txt.value='';
         }
    }
    
    function del(a){
        
        a.parentNode.parentNode.removeChild(a.parentNode)
    }
</script>
</body>
</html>